<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Auth;
use Illuminate\Validation\Rule;

class PackageRequest extends FormRequest
{
    public function authorize()
    {
        return Auth::user()->isSuperAdmin;
    }

    public function rules()
    {
        return [
            'title' => ['required', 'between:3,50', Rule::unique('packages')->ignore(request('package'))],
        ];
    }
    public function attributes()
    {
        return ['title' => '套餐名称'];
    }
}
